<template>
  <div class="goods-hot">
    <h3 v-if="type===1">24小时热榜</h3>
    <h3 v-else-if="type===2">周热榜</h3>
    <h3 v-else-if="type===3">总热榜</h3>
    <!-- 商品区块 -->
    <GoodsItem v-for="(item, index) in list" :key="index" :goods="item"/>
  </div>
</template>
<script>
import { ref } from 'vue'
import GoodsItem from '@/views/category/components/goods-item.vue'
import { FindGetGoodsHot } from '@/api/goods'
export default {
  name: 'GoodsHot',
  components: {
    GoodsItem
  },
  props: {
    type: {
      type: Number,
      default: 1
    },
    goodsId: {
      type: String
    }
  },
  setup (props) {
    const list = ref([])
    FindGetGoodsHot({ id: props.goodsId, type: props.type }).then(({ result }) => {
      list.value = result
      // console.log(32, list)
    })
    return { list }
  }
}
</script>
<style scoped lang="less">
.goods-hot {
  h3 {
    height: 70px;
    background: @helpColor;
    color: #fff;
    font-size: 18px;
    line-height: 70px;
    padding-left: 25px;
    margin-bottom: 10px;
    font-weight: normal;
  }
}
</style>
